//
//  RZApiManager.h
//  RZIM
//
//  Created by reyzhang on 2021/7/26.
//  Api 管理器

#import <Foundation/Foundation.h>
#import "NetworkTools.h"
#import "RZIMDefine.h"


NS_ASSUME_NONNULL_BEGIN

//登录
extern NSString *const UserLogin;
//创建单聊,私聊
extern NSString *const CreatePrivateChat;
//发送消息
extern NSString *const SendMessage;
//创建群组
extern NSString *const CreateGroup;
//群组列表，会话列表
extern NSString *const GroupList;
//群组详情
extern NSString *const GroupDetail;
//解散群组
extern NSString *const DismissGroup;
//邀请进群
extern NSString *const InviteToJoinGroup;
//删除会话
extern NSString *const RemoveConversation;
//群组消息免打扰
extern NSString *const DisturbGroup;
//请离群组中的用户
extern NSString *const KickUsersOfGroup;
//离开群组
extern NSString*const LeaveGroup;
//修改群组名称
extern NSString *const UpdateGroupName;
//设置群组置顶
extern NSString *const SetupGroupToTop;
//修改用户资料
extern NSString *const UpdateUserInfo;

/*****************************************************/
//消息列表
extern NSString *const MessageList;
//文件上传 (语音文件，图片文件，视频文件)
extern NSString *const FileUpload;


@interface RZApiManager : NSObject



/**
 登录
 */
+ (void)userLoginWithUserId:(NSString *)userId
                       name:(NSString *)name
                   portrait:(NSString *)portrait
                    success:(RZSuccessBlock)RZSuccessBlock
                    failure:(RZFailureBlock)RZFailureBlock;



#pragma mark - 群组相关
/**
 与目标用户建立单聊
 @label 标签，分组会话
 */
+ (void)createPrivateChatWithTargetId:(NSString *)tid
                                label:(NSInteger)label
                              success:(RZSuccessBlock)RZSuccessBlock
                              failure:(RZFailureBlock)RZFailureBlock;



/**
 发送消息
 */
+ (void)sendMessageWithGroupId:(NSString *)groupId
                       message:(NSString *)message
                   messageType:(RZMessageType)messageType
                     extraData:(id)extraData
                      success:(RZSuccessBlock)RZSuccessBlock
                      failure:(RZFailureBlock)RZFailureBlock;



/**
 创建群组。
 @label标签，可以用来区分
 @uids 群组用户， 多用户之间用,号分割
 */
+ (void)createGroupWithName:(NSString *)name
                   portrait:(NSString *)portrait
                       uids:(NSString *)uids
                      label:(NSInteger)label
                    success:(RZSuccessBlock)RZSuccessBlock
                    failure:(RZFailureBlock)RZFailureBlock;

/**
 群组列表,会话列表
 @types 会话类型，多种会话类型之间用,号分割
 */
+ (void)groupListWithPage:(NSInteger)page
                 pageSize:(NSInteger)pageSize
                groupType:(NSString *)types
                    label:(NSInteger)label
                 queryStr:(NSString *)queryStr
                  success:(RZSuccessBlock)RZSuccessBlock
                  failure:(RZFailureBlock)RZFailureBlock;


/**
 获取群组详情
 */
+ (void)getGroupDetailWithGroupId:(NSString *)groupId
                        success:(RZSuccessBlock)RZSuccessBlock
                        failure:(RZFailureBlock)RZFailureBlock;


/**
 解散群组
 */
+ (void)dismissGroupWithGroupId:(NSString *)groupId
                        success:(RZSuccessBlock)RZSuccessBlock
                        failure:(RZFailureBlock)RZFailureBlock;

/**
 邀请进群
 */
+ (void)inviteToJoinGroupWithGroupId:(NSString *)groupId
                             uidList:(NSArray *)uidList
                             success:(RZSuccessBlock)RZSuccessBlock
                             failure:(RZFailureBlock)RZFailureBlock;


/**
 删除会话，只针对当前用户。有新的消息来时，会话还会显示
 */
+ (void)removeConversationWithGroupId:(NSString *)groupId
                              success:(RZSuccessBlock)RZSuccessBlock
                              failure:(RZFailureBlock)RZFailureBlock;

/**
 设置群组的消息免打扰
 */
+ (void)disturbGroupWithGroupId:(NSString *)groupId
                        success:(RZSuccessBlock)RZSuccessBlock
                        failure:(RZFailureBlock)RZFailureBlock;

/**
 从群组中请离用户, 创建群组的群主有权限请离用户
 @groupId 群组ID
 @uidList 请离用户,用户数组
 */
+ (void)kickUsersWithGroupId:(NSString *)groupId
                     uidList:(NSArray *)uidList
                     success:(RZSuccessBlock)RZSuccessBlock
                     failure:(RZFailureBlock)RZFailureBlock;


/**
 用户主动离开群组
 */
+ (void)leaveGroupWithGroupId:(NSString *)groupId
                      success:(RZSuccessBlock)RZSuccessBlock
                      failure:(RZFailureBlock)RZFailureBlock;


/**
 修改群组名称
 @groupName: 新的群组名称
 */
+ (void)updateGroupNameWithGroupId:(NSString *)groupId
                         groupName:(NSString *)groupName
                           success:(RZSuccessBlock)RZSuccessBlock
                           failure:(RZFailureBlock)RZFailureBlock;


/**
 设置群组置顶
 */
+ (void)setupGroupToTopWithGroupId:(NSString *)groupId
                       success:(RZSuccessBlock)RZSuccessBlock
                       failure:(RZFailureBlock)RZFailureBlock;

#pragma mark  - 消息相关

/**
 获取群组消息
 */
+ (void)messageListWithGroupId:(NSString *)groupId
                          page:(NSInteger)page
                      pageSize:(NSInteger)pageSize
                      queryStr:(NSString *)queryStr
                       success:(RZSuccessBlock)RZSuccessBlock
                       failure:(RZFailureBlock)RZFailureBlock;


/**
 文件上传
 */
+ (void)uploadWithFiles:(NSArray *)files
               progress:(void(^)(int progress))progressBlock
                success:(RZSuccessBlock)RZSuccessBlock
                failure:(RZFailureBlock)RZFailureBlock;


/**
 修改用户信息
 */
+ (void)updateUserInfoWithUserId:(NSString *)uid
                            name:(NSString *)name
                          avatar:(NSString *)avatar
                         success:(RZSuccessBlock)RZSuccessBlock
                         failure:(RZFailureBlock)RZFailureBlock;
@end

NS_ASSUME_NONNULL_END
